﻿using System;
using System.Net;

namespace Microsoft.Coding4Fun.TweetCraft.Twitter
{
    public sealed class WebDownloadClient : DownloadClient
    {
        /// <summary>
        /// Downloads a file from the given url to the destination path.
        /// </summary>
        /// <param name="url">The url of the file.</param>
        /// <param name="destinationPath">The destination path.</param>
        public override void DownloadFile(Uri url, string destinationPath)
        {
            if (url == null) 
                throw new ArgumentNullException("url");
            if (destinationPath == null) 
                throw new ArgumentNullException("destinationPath");

            using (var webClient = new WebClient())
            {
                // Download the file using WebClient
                webClient.DownloadFile(url, destinationPath);
            }
        }
    }
}